package com.hsgene.product.constants;

import com.hsgene.common.util.exception.ValidationException;

/**
 * @Description: //套餐检测周期自然日or工作日
 * @ProjectName: hdas-geneshop-server
 * @Package: com.hsgene.product.constants
 * @Author: FX
 * @CreateDate: 2019/1/21 14:12
 * @Version: 1.0
 * Copyright: Copyright (c) 2019
 */
public enum PeriodType {
    /**
     * 套餐周期
     */
    WORKING_DAY(0,"工作日"),
    NATURE_DAY(1,"自然日");
    private int code;
    private String desc;

    PeriodType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
    public static PeriodType getEnum(int code){
        for(PeriodType type:values()){
            if(code==type.getCode()){
                return type;
            }
        }
        throw new ValidationException("周期单位枚举异常");
    }
}
